package basketMatcher;

import java.util.*;

import utils.MultiTreeMap;

import ClassPack.Class;
import ClassPack.ClassDiagram;
import algorithms.ClassGrader;


import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MultiHashtable;

public class BasketMatcher {

	private Vector<Basket> m_baskets;
	private MultiTreeMap m_sorted_baskets = new MultiTreeMap();
	private Vector<ClassGraderRatio> m_algorithms = new Vector<ClassGraderRatio>();
	private Vector <ClassDiagram> m_classDiagrams = 
			new Vector<ClassDiagram>();
	
	public void createBaskets(){
		m_baskets = 
			BasketCreater.createBasketVector
		(m_classDiagrams, m_baskets);
		
	}
	
	
	public void addClassDiagram(ClassDiagram cd) {
		
		m_classDiagrams.add(cd);
	}
	
	private void addBasket(Basket b) {
		
		m_sorted_baskets.put(new Double(b.getBasketGrade(m_algorithms)), b);
	}
	
	public void addAlgorithm(double ratio , ClassGrader cg) {
		
		m_algorithms.add(new ClassGraderRatio(cg , ratio));
	}
	
	public void gradeAllbaskets() {
	
		for (Basket b : m_baskets) { 
			addBasket(b);
		}
	}


	public Vector<Basket> getM_baskets() {
		return m_baskets;
	}


	public void setM_baskets(Vector<Basket> m_baskets) {
		this.m_baskets = m_baskets;
	}


	public MultiTreeMap getM_sorted_baskets() {
		return m_sorted_baskets;
	}


	public void setM_sorted_baskets(MultiTreeMap m_sorted_baskets) {
		this.m_sorted_baskets = m_sorted_baskets;
	}


	public Vector<ClassDiagram> getM_classDiagrams() {
		return m_classDiagrams;
	}


	public void setM_classDiagrams(Vector<ClassDiagram> diagrams) {
		m_classDiagrams = diagrams;
	}	
	
	
}
